#include <iostream>
#include <algorithm>
#include <map>
#include <cstdio>
using namespace std;

long long n, q, a[8005], cur[8005];
map<long long, long long> cnt;

int main()
{
	freopen( "sort.in", "r", stdin );
	freopen( "sort.out", "w", stdout );
	cin >> n >> q;
	for( long long i = 1; i <= n; i++ )
	{
		cin >> a[i];
		cnt[a[i]]++;
		cur[i] = cnt[a[i]];
	}
	for( long long i = 1; i <= q; i++ )
	{
		long long op;
		cin >> op;
		if( op == 1 )
		{
			long long x, v;
			cin >> x >> v;
			a[x] = v;
			cnt.clear();
			for( long long j = 1; j <= n; j++ )
			{
				cnt[a[j]]++;
				cur[j] = cnt[a[j]];
			}
		}
		else
		{
			long long x, ans, tmp[8005];
			for( long long j = 1; j <= n; j++ )
			{
				tmp[j] = a[j];
			}
			sort( tmp + 1, tmp + n + 1 );
			cin >> x;
			ans = lower_bound( tmp + 1, tmp + n + 1, a[x] ) - tmp + cur[x] - 1;
			cout << ans << endl;
		}
	}
	return 0;
}
